﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DingTalkAgent.Web.Models
{
    public class ErrorLog
    {
        /// <summary>
        /// 写入错误日志
        /// </summary>
        /// <param name="UserID">用户ID</param>
        /// <param name="methed">contr/action</param>
        /// <param name="ErrMsg">错误信息</param>
        /// <param name="LoginName">登录者</param>
        /// <returns></returns>
        public static int Add(int UserID, string methed, string ErrMsg, string LoginName, string xx = "")
        {
            //var Dal = new SqlData.ErrorLog();
            //var model = new Model.ErrorLog()
            //{
            //    Site_ID = 1,
            //    Er_Msg = ErrMsg,
            //    Er_type = methed,
            //    User_ID = UserID,
            //    LoginName = LoginName,
            //    Op_Time = DateTime.Now

            //};
            //return Dal.Add(model);
            Discuz.Common.LogInfo.WriteLog(System.Web.HttpContext.Current.Server.MapPath("/Log/Error.txt"), methed, ErrMsg);
            return 1;
        }
    }
}